package com.lambda.demo.stream;

import com.lambda.demo.models.AuthorsData;

public class StreamSkipTest {
  public static void main(String[] args) {

//  要求找到年龄>100岁的作家,跳过第一个作家
    AuthorsData.getAuthors().stream()
      .filter(a -> a.getAge() > 100)
      .skip(1)
      .forEach(a -> System.out.println(a.getName()));

    AuthorsData.getAuthors().stream()
      .filter(a -> a.getAge() > 100)
      .limit(1)
      .forEach(a -> System.out.println(a.getName()));
  }
}
